<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<%include("/common/include.html"){}%>
	</head>
	<body class="easyui-layout">
	<div data-options="region:'north',split: true,title:'快速查询'" style="height:120px;padding:10px;">
	<!-- <input id="orgid"  type="hidden" value="${orgid!}"> -->
		<form id="zdDailyStatisticFrom"  action="${cxt!}/zdDailyStastic/excel">
		
			<div style="margin-bottom: 10px;float:left;margin-right: 10px;">
					<label class="label-top" style="width: 100%; display: block;">日期</label>
					<input id = "startTime" name="startTime" value='${date(),dateFormat="yyyy-MM-dd"}'  class="easyui-datebox theme-textbox-radius" style="height:32px;width:212px;text-align:center"/>
		            <input name="_query.ORGANIDS" id="organIds" type="hidden" value="${curOrgan.ids! }">
			</div>
			<div style="margin-bottom: 10px;float:left;margin-right: 10px;">
				<label class="label-top" style="width: 100%; display: block;">结束日期</label>
				<input id = "endTime" name="endTime" value='${date(),dateFormat="yyyy-MM-dd"}' class="easyui-datebox theme-textbox-radius" style="height:32px;width:212px;text-align:center"/>
			</div>
			
			<div>
				<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'"  style="width:212px;height:32px;float:left;margin-top: 16px;margin-right: 10px;"  onclick="searchBus()">搜索</a>
			</div>
			<div style="margin-bottom: 10px;float:left;margin-top: 16px;margin-right: 10px;">
				<a href="#" onclick='zdDailyInfo_xls()' class="easyui-linkbutton" data-options="iconCls:'icon-pageexcel'" style="width:212px">导出</a>
			</div>
		</form>
		</div>
		<div data-options="region:'center'" style="overflow-x:hidden;">
		<table class="easyui-datagrid" id ="zdDailyStasticInfo" style="width:100%;height:auto;"></table>
		</div>
		
		<script>
		
		
		var $form = $('#zdDailyStatisticFrom');
		function zdDailyStastic(){
			$('#zdDailyStasticInfo').datagrid({
				cls: "theme-datagrid",
				singleSelect: true,
				rownumbers: true, //显示序号
				fitColumns:true,
				pagination: false,
				url: "zdDailyStastic/getList",
				queryParams: sy.serializeObject($form),
			    method: 'post',
			    collapsible:true,
			    columns:[[
							{field:'ids',title:'ids',width:10,align:'center',hidden:true},
							{field:'organname',title:'机构',width:10,align:'center'},
							{field:'zcgd',title:'注册登记',width:10,align:'center'},
							{field:'zygd',title:'转移登记',width:10, align:'center'},
							{field:'bggd',title:'变更登记',width:10,align:'center'},
							{field:'bhpgd',title:'补换号牌',width:10, align:'center'},
							{field:'bzjgd',title:'补换证件',width:10, align:'center'},
							{field:'zxgd',title:'注销登记',width:10, align:'center'}
							]],
				 onLoadSuccess:function(data){
						var rows = $('#zdDailyStasticInfo').datagrid('getRows');
						if(rows.length > 0){
							$('#zdDailyStasticInfo').datagrid('insertRow', {
								index: 0,
								row: {
										organname: '合计',
										zcgd:compute_GXC('zcgd'),
										zygd:compute_GXC('zygd'),
										bggd:compute_GXC('bggd'),
										bhpgd:compute_GXC('bhpgd'),
										bzjgd:compute_GXC('bzjgd'),
										zxgd:compute_GXC('zxgd')
									
								}
				             });
					
					
						} 
					}
			})
			
		}
		function zdDailyInfo_xls(){
			$form.submit();
		}
		//指定列求和
		function compute_GXC(colName) {
		     var rows = $('#zdDailyStasticInfo').datagrid('getRows');
		     var total = 0;
		     for (var i = 0; i < rows.length; i++) {
		    	 if(typeof(rows[i][colName]) != 'undefined'){
		    		 total += parseFloat(rows[i][colName]);
		    	 }
		     }
		     if(total > 0){
		    	 return total;
		     }else{
		    	 return 0;
		     }
		}
		
		$(document).ready(function () {
			 zdDailyStastic();
		});
		
		
		function searchBus(){
			 zdDailyStastic();
		}
		
		
		</script>
	</body>
</html>
